//2.动态申请一个整型数组，并给每个元素赋值，要求删除第3个元素
#include<stdio.h>
#include<stdlib.h>
int main()
{
	
	int *p = (int*)calloc(10,sizeof(int));	
	int n = 10;
	int m = 3;
	register int i = 0;
	for(i = 0; i < n; i++)
	{
		p[i] = rand() % 100;
		printf("%4d",p[i]);
	}
	printf("\n");
	for(i = 0; i < n; i++)
	{
		if(i+1 >= m && i != n-1)
		{
			p[i] = p[i+1];
		}
	}
	int *q = realloc(p,sizeof(int) * (n-1));
	if(q == NULL)
	{
		free(p);
		puts("调整失败");
		return -1;
	}
	for(i = 0; i < n - 1; i++)
	{
		printf("%4d",q[i]);
	}
	printf("\n");
	free(q);
	return 0;
}
